package com.rabbiter.oes.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.rabbiter.oes.entity.Message;
import org.apache.ibatis.annotations.*;

@Mapper
public interface MessageMapper extends BaseMapper<Message> {

    default IPage<Message> findAll(Page page) {
        LambdaQueryWrapper<Message> wrapper = Wrappers.lambdaQuery(Message.class);
        wrapper.orderByDesc(Message::getId);
        return selectPage(page, Wrappers.lambdaQuery());
    }

}
